package com.neusoft.chanceserver.controller;


import com.neusoft.chanceserver.dto.PurchaseAdd;
import com.neusoft.chanceserver.dto.RespBean;
import com.neusoft.chanceserver.entity.Purchase;
import com.neusoft.chanceserver.service.IPurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 购买决策人信息表 前端控制器
 * </p>
 *
 * @author liuxp
 * @since 2021-07-12
 */
@RestController
@RequestMapping("/chance")
public class PurchaseController {
    @Autowired
    IPurchaseService iPurchaseService;

    @PostMapping("/searchPurchase/{chanceId}")
    RespBean searchPurchaseByChanceId(@PathVariable Integer chanceId){
        return iPurchaseService.searchPurchaseByChanceId(chanceId);
    }

    @PostMapping("/addPurchase")
    RespBean addPurchase(@RequestBody PurchaseAdd purchaseAdd){
        return iPurchaseService.addPurchase(purchaseAdd);
    }

    @PostMapping("/updatePurchase")
    RespBean updatePurchase(@RequestBody Purchase purchase){
        return iPurchaseService.updatePurchase(purchase);
    }

    @PostMapping("/deletePurchase/{purchaseId}")
    RespBean deletePurchase(@PathVariable Integer purchaseId){
        return iPurchaseService.deletePurchase(purchaseId);
    }

}

